﻿// 1.1.6.07. Write a program that calculates N!*K! / (K-N)! for given N and K (1<N<K).

using System;

class FactorialSequence
{
    static void Main()
    {
        Console.Write("N: ");
        int dividend = int.Parse(Console.ReadLine());   
        Console.Write("K: ");
        int divisor = int.Parse(Console.ReadLine());    
        int predicate = dividend - divisor;
        if (dividend > 1 && divisor > 1)                
        {
            if (divisor > dividend)                     
            {
                divisor += dividend;
                dividend = divisor - dividend;
                divisor -= dividend;
                predicate = dividend - divisor;
            }
            
            for (int dividendFactorialCounter = dividend - 1, dividendCalculations = dividend; dividendFactorialCounter > 1; dividendFactorialCounter--)
            {
                dividendCalculations *= dividendFactorialCounter;
                if (dividendFactorialCounter == 2)
                {
                    dividend = dividendCalculations;
                }
            }
            for (int divisorFactorialCounter = divisor - 1, divisorCalculations = divisor; divisorFactorialCounter > 1; divisorFactorialCounter--)
            {
                divisorCalculations *= divisorFactorialCounter;
                if (divisorFactorialCounter == 2)
                {
                    divisor = divisorCalculations;
                }
            }
            for (int predicateFactorialCounter = predicate - 1, predicateCalculations = predicate; predicateFactorialCounter > 1; predicateFactorialCounter--)
            {
                predicateCalculations *= predicateFactorialCounter;
                if (predicateFactorialCounter == 2)
                {
                    predicate = predicateCalculations;
                }
            }
        }
        Console.WriteLine(dividend * divisor / predicate);
    }
}
